package com.boot;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;

public class TestGetCode {

    public static void main(String[] args) {
        //认证，获取令牌
        String appid="appid";
        String secret="secret";
        //http://127.0.0.1:8080/oauth/authorize?response_type=code&client_secret=secret&client_id=appid
        String url  = "http://127.0.0.1:8080/oauth/authorize?response_type=code&username=admin&password=123456&client_secret=secret&client_id="+appid;
        HttpRequest request =  HttpUtil.createPost(url);
        //request.basicAuth(username,password);
        String result =  request.execute().body();
        System.out.println(result);
    }
}

